Optimal. Leaf size=213 \[ \frac {d^3 \left (a^2 (2-n)+b^2 (1-n)\right ) \cos (e+f x) (d \csc (e+f x))^{n-3} \, _2F_1\left (\frac {1}{2},\frac {3-n}{2};\frac {5-n}{2};\sin ^2(e+f x)\right )}{f (1-n) (3-n) \sqrt {\cos ^2(e+f x)}}+\frac {a^2 d^2 \cot (e+f x) (d \csc (e+f x))^{n-2}}{f (1-n)}+\frac {2 a b d^2 \cos (e+f x) (d \csc (e+f x))^{n-2} \, _2F_1\left (\frac {1}{2},\frac {2-n}{2};\frac {4-n}{2};\sin ^2(e+f x)\right )}{f (2-n) \sqrt {\cos ^2(e+f x)}} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.27, antiderivative size = 213, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 5, integrand size = 23, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.217, Rules used = {3238, 3788, 3772, 2643, 4046} \[ \frac {d^3 \left (a^2 (2-n)+b^2 (1-n)\right ) \cos (e+f x) (d \csc (e+f x))^{n-3} \, _2F_1\left (\frac {1}{2},\frac {3-n}{2};\frac {5-n}{2};\sin ^2(e+f x)\right )}{f (1-n) (3-n) \sqrt {\cos ^2(e+f x)}}+\frac {a^2 d^2 \cot (e+f x) (d \csc (e+f x))^{n-2}}{f (1-n)}+\frac {2 a b d^2 \cos (e+f x) (d \csc (e+f x))^{n-2} \, _2F_1\left (\frac {1}{2},\frac {2-n}{2};\frac {4-n}{2};\sin ^2(e+f x)\right )}{f (2-n) \sqrt {\cos ^2(e+f x)}} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 2643
Rule 3238
Rule 3772
Rule 3788
Rule 4046
Rubi steps
\begin {align*} \int (d \csc (e+f x))^n (a+b \sin (e+f x))^2 \, dx &=d^2 \int (d \csc (e+f x))^{-2+n} (b+a \csc (e+f x))^2 \, dx\\ &=(2 a b d) \int (d \csc (e+f x))^{-1+n} \, dx+d^2 \int (d \csc (e+f x))^{-2+n} \left (b^2+a^2 \csc ^2(e+f x)\right ) \, dx\\ &=\frac {a^2 d^2 \cot (e+f x) (d \csc (e+f x))^{-2+n}}{f (1-n)}+\left (d^2 \left (b^2+\frac {a^2 (2-n)}{1-n}\right )\right ) \int (d \csc (e+f x))^{-2+n} \, dx+\left (2 a b d (d \csc (e+f x))^n \left (\frac {\sin (e+f x)}{d}\right )^n\right ) \int \left (\frac {\sin (e+f x)}{d}\right )^{1-n} \, dx\\ &=\frac {a^2 d^2 \cot (e+f x) (d \csc (e+f x))^{-2+n}}{f (1-n)}+\frac {2 a b \cos (e+f x) (d \csc (e+f x))^n \, _2F_1\left (\frac {1}{2},\frac {2-n}{2};\frac {4-n}{2};\sin ^2(e+f x)\right ) \sin ^2(e+f x)}{f (2-n) \sqrt {\cos ^2(e+f x)}}+\left (d^2 \left (b^2+\frac {a^2 (2-n)}{1-n}\right ) (d \csc (e+f x))^n \left (\frac {\sin (e+f x)}{d}\right )^n\right ) \int \left (\frac {\sin (e+f x)}{d}\right )^{2-n} \, dx\\ &=\frac {a^2 d^2 \cot (e+f x) (d \csc (e+f x))^{-2+n}}{f (1-n)}+\frac {2 a b \cos (e+f x) (d \csc (e+f x))^n \, _2F_1\left (\frac {1}{2},\frac {2-n}{2};\frac {4-n}{2};\sin ^2(e+f x)\right ) \sin ^2(e+f x)}{f (2-n) \sqrt {\cos ^2(e+f x)}}+\frac {\left (b^2+\frac {a^2 (2-n)}{1-n}\right ) \cos (e+f x) (d \csc (e+f x))^n \, _2F_1\left (\frac {1}{2},\frac {3-n}{2};\frac {5-n}{2};\sin ^2(e+f x)\right ) \sin ^3(e+f x)}{f (3-n) \sqrt {\cos ^2(e+f x)}}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A] time = 0.39, size = 135, normalized size = 0.63 \[ -\frac {d \cos (e+f x) \sin ^2(e+f x)^{\frac {n-1}{2}} (d \csc (e+f x))^{n-1} \left (a \left (a \, _2F_1\left (\frac {1}{2},\frac {n+1}{2};\frac {3}{2};\cos ^2(e+f x)\right )+2 b \sqrt {\sin ^2(e+f x)} \csc (e+f x) \, _2F_1\left (\frac {1}{2},\frac {n}{2};\frac {3}{2};\cos ^2(e+f x)\right )\right )+b^2 \, _2F_1\left (\frac {1}{2},\frac {n-1}{2};\frac {3}{2};\cos ^2(e+f x)\right )\right )}{f} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [F] time = 0.58, size = 0, normalized size = 0.00 \[ {\rm integral}\left (-{\left (b^{2} \cos \left (f x + e\right )^{2} - 2 \, a b \sin \left (f x + e\right ) - a^{2} - b^{2}\right )} \left (d \csc \left (f x + e\right )\right )^{n}, x\right ) \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [F] time = 0.00, size = 0, normalized size = 0.00 \[ \int {\left (b \sin \left (f x + e\right ) + a\right )}^{2} \left (d \csc \left (f x + e\right )\right )^{n}\,{d x} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [F] time = 7.82, size = 0, normalized size = 0.00 \[ \int \left (d \csc \left (f x +e \right )\right )^{n} \left (a +b \sin \left (f x +e \right )\right )^{2}\, dx \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [F] time = 0.00, size = 0, normalized size = 0.00 \[ \int {\left (b \sin \left (f x + e\right ) + a\right )}^{2} \left (d \csc \left (f x + e\right )\right )^{n}\,{d x} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [F] time = 0.00, size = -1, normalized size = -0.00 \[ \int {\left (\frac {d}{\sin \left (e+f\,x\right )}\right )}^n\,{\left (a+b\,\sin \left (e+f\,x\right )\right )}^2 \,d x \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F] time = 0.00, size = 0, normalized size = 0.00 \[ \int \left (d \csc {\left (e + f x \right )}\right )^{n} \left (a + b \sin {\left (e + f x \right )}\right )^{2}\, dx \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________